<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;

class ComposerServiceProvider extends ServiceProvider
{

    public function boot()
    {
        $channel = [
            'admin.stat.data',
            'admin.stat.retention',
            'admin.stat.ltv',
            'admin.stat.server',
            'admin.stat.online',
            'admin.stat.liveOnline',
            'admin.stat.userLevel',

            'admin.pay.rank',
            'admin.pay.stat',
            'admin.pay.trade',
            'admin.pay.grade',

            'admin.chatlog.*',
        ];
        View::composer($channel, 'App\Http\ViewComposers\ChannelComposer');

        $channel = [
            'admin.admins.create',
            'admin.admins.edit',
        ];
        View::composer($channel, 'App\Http\ViewComposers\ChannelAllComposer');

        $channelRadio = [
            'game_tool.mail.create',
            'game_tool.mail.batchCreate',
            'admin.userinfo.*',
            'game_tool.recharge.create',
            'game_tool.recharge.batchCreate',
        ];
        View::composer($channelRadio, 'App\Http\ViewComposers\ChannelRadioComposer');

        $channelRadioAll = [
            'config.servers.*',
            'finance.check.index',
        ];
        View::composer($channelRadioAll, 'App\Http\ViewComposers\ChannelRadioAllComposer');

        $server = [
            'admin.stat.data',
            'admin.stat.retention',
            'admin.stat.ltv',
            'admin.stat.server',
            'admin.stat.online',
            'admin.stat.liveOnline',
            'admin.stat.userLevel',

            'admin.pay.rank',
            'admin.pay.stat',
            'admin.pay.trade',
            'admin.pay.grade',

            'admin.chatlog.*',
        ];
        View::composer($server, 'App\Http\ViewComposers\ServerComposer');

        $serverRadio = [
            'game_tool.mail.create',
            'game_tool.recharge.create',
            'admin.userinfo.index',
        ];
        View::composer($serverRadio, 'App\Http\ViewComposers\ServerRadioComposer');

        $between = [
            'admin.chatlog.*',
            'admin.stat.data',
            'admin.stat.retention',
            'admin.stat.ltv',
            'admin.stat.server',
            'admin.stat.online',
            'admin.stat.liveOnline',
            'admin.stat.userLevel',

            'admin.pay.rank',
            'admin.pay.stat',
            'admin.pay.trade',
            'admin.pay.grade',
        ];
        View::composer($between, 'App\Http\ViewComposers\BetweenDateComposer');

        View::composer(['admin.chatlog.index'], 'App\Http\ViewComposers\ChatComposer');

        $gameComposer = [
            'total_data.stat.sumData',
            'admin.admins.create',
            'admin.admins.edit',
        ];
        View::composer($gameComposer, 'App\Http\ViewComposers\GameComposer');

        $gameRadio = [
            'config.channels.*',
            'config.servers.*',
            'finance.check.index',
        ];
        View::composer($gameRadio, 'App\Http\ViewComposers\GameRadioComposer');

    }

    public function register()
    {

    }
}